<?php

namespace app\api\controller;

use app\common\controller\Api;
use think\Db;

/**
 * 首页接口
 */
class Index extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * 首页
     *
     */
    public function index()
    {
        $this->success('请求成功');
    }


    //检测已经过期的订单
    public function getOrder()
    {
        $list = Db::table('jy_shopro_order')->where(['type'=>'yqs_goods','status'=>'paid'])->where('chat_end_time','<',time())->select();
        if($list){
            foreach ($list as $k => $v) {
                Db::table('jy_shopro_order')->where('id',$v['id'])->update(['status'=>'completed']);
            }
        }
    }
}
